<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tampilkan Poling</title>
<style type="text/css" media="screen">
#Paket {
	background-color: #6CC;
	display: block;
	border: thin solid #060;
	width: 800px;
	height:auto;
}
#Header {
	font-family: "Comic Sans MS", cursive;
	font-size: 16px;
	font-style: normal;
	font-weight: bold;
	height: auto;
	width: 800px;
}


#submit {
	background-image: url(Submit.jpg);
	
}
</style>
</head>

<body>
<?php
	$kelompok='Modul';
	require_once('connect.php');
	$query_tampil_polling = "SELECT ID,pertanyaan, jenis FROM pertanyaan WHERE kelompok='$kelompok' ORDER BY ID";
	echo "<form method='post' action='Tes_sesi.php' enctype='multipart/form-data'>\n";
	echo "<table align='center' width=800>\n";
	$hasil_query=mysql_query($query_tampil_polling);
	  	
	while($arr_hasil=mysql_fetch_row($hasil_query)){
		echo "<tr id='Header' height=15>\n";
		echo "<td width=800>\n";
		echo $arr_hasil[1]."\n";
		echo "</td>\n";
		echo "</tr>\n";
		echo "<tr id='Paket'>\n";
		echo "<td>\n";
		$name_pilihan="Pertanyaan_".$arr_hasil[0];
		if($arr_hasil[2]!=3){
			$query_tampil_pilihan="SELECT pilihan,pilihan_alias FROM pilihan WHERE ID='$arr_hasil[0]' ORDER BY pilihan_alias";	
			$jenis_poll=mysql_query("SELECT Jenis FROM pol_type WHERE Id='$arr_hasil[2]'");
			$type = mysql_fetch_row($jenis_poll);
			$arr_pil=mysql_query($query_tampil_pilihan);
			$i=1;
			while($row_pil=mysql_fetch_row($arr_pil)){				
				if($arr_hasil[2]==1){
					if($i==1)
						echo "<input type='$type[0]' value=$row_pil[1] name=$name_pilihan>$row_pil[0]<br/>\n";
					else
						echo "<input type='$type[0]' value=$row_pil[1] name=$name_pilihan>$row_pil[0]<br/>\n";
				}else if($arr_hasil[2]==2){
					echo "<input type='$type[0]' value=$row_pil[1] name=$row_pil[1]>$row_pil[0]<br/>\n";
				}
				$i++;
			}
		}else{
			echo "<input size=60 maxlength=60 type='text' name='$name_pilihan'/>";
		}
		echo "</td>\n";
		echo "</tr>\n";
		echo "<tr height=10><td></td></tr>\n";
	}
	echo "<tr><td><input id='submit' type='submit' value='Submit'></td></tr>\n";
	echo "</table>\n";
	echo "</form>\n";
?>
</body>
</html>